package cn.com.sinosoft.ares.insurance.dao;

import cn.com.sinosoft.ares.insurance.model.PrpDUserDual;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


/**
 * Description: 用户表
 * Author: lishangmin
 * Created: 2018-06-26 10:54
 */
@Mapper
@Repository
public interface PrpDUserDao {

    @Select("select comcode from PrpdUser where usercode = #{userCode}")
    String selectComCodeByPrimaryKey(@Param("userCode") String userCode);

    @Select("select ag.agentname,da.agenttype,da.handlercode,de.topcommission,de.riskcode" +
            "from prpduser us, prpdagent da, agentrelation ag, prpdagreedetail de" +
            "where us.usercode = ag.usercode and da.agentcode = ag.agentcode and de.agentcode = ag.agentcode" +
            "and de.riskcode =#{riskCode}  and us.usercode = #{userCode}")
    PrpDUserDual selectByRiskcodeAndUsercode(@Param("riskCode") String riskCode, @Param("userCode") String userCode);
}
